<?php
define('SCR','type');
require_once('global.php');
require_once(R_P . 'require/init.php');

$typeid = GetCookie('typeid');
$page = GetCookie('page');
unset($_GET,$_POST,$_REQUEST);

if (empty($typeid))
{
	$typeid = '3';
	$typename = '所有资源';
}
else
{
	$typename = $restype[$typeid]['typename']; ;
}
require_once(R_P . 'require/class_resource.php');
$res = new Resource();
//echo $typeid;

$res->setType($typeid);
$res->setWhere('delflag = 0');

$pagesize = 60; //一页展示30个

$resarray = $res->getList($page, $pagesize);

//print_r($resarray);exit;
ob_end_clean();
header('Date:Sun,02 Nov 2008 06:28:16 GMT');
header('Expires:Sun,02 Nov 1970 08:00:00 GMT');
header('Cache-Control:no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0');
header('Pragma: No-Cache');
//header('Content-Encoding: utf-8');
header('Content-type: application/xml;charset=utf-8');
echo '<?xml version="1.0" encoding="UTF-8"?>
<gallery xmlns:media="http://search.yahoo.com/mrss/">
	<settings>
		<mediaFolder type="large" media="video"></mediaFolder><!--FLV文件-->
		<mediaFolder type="large" media="image"></mediaFolder> <!--大图-->
		<mediaFolder type="thumbnail" media="image"></mediaFolder> <!--缩略图-->

		<mediaFolder type="thumbnail" media="video"></mediaFolder>
		<mediaFolder type="large" media="swf"></mediaFolder> <!--FLV文件的大图-->
		<mediaFolder type="thumbnail" media="swf"></mediaFolder> <!--FLV文件的缩略图-->
	</settings>';

foreach ($resarray as $r)
{
	if ($r['ifvideo'] && !$r['ifconvert']) {
		continue;
	}
	echo "<item><media:text>$r[filetitle]</media:text>";

	if ($r['ifconvert']) {
		echo "<media:thumbnail url=\"$r[videopic]\" />";
		//echo "<media:large url=\"$r[videopic2]\" />";
		echo "<media:content url=\"$r[flvurl]\" type=\"video/x-flv\" width=\"480\" height=\"320\" />";
		//echo "<media:content url=\"$pic\" type=\"image/jpeg\" width=\"500\" height=\"500\" />";
	} else {
		$smaillpic = getSmallPic($r['url'], 1);
		$bigpic = getSmallPic($r['url'], 2);
		echo "<media:thumbnail url=\"$smaillpic\" />";
		echo "<media:content url=\"$bigpic\" type=\"image/jpeg\" width=\"$r[picwidth]\" height=\"$r[picheight]\" />";
	}

	echo "</item>";
	echo "";
	/*
	echo '		<media:text> 测试视频 </media:text>
	<media:thumbnail url="6.jpg" />
	<media:content url="200810/29/d6a8196e68.flv" type="video/x-flv" width="480" height="320" />
	</item>';
	*/
}
echo '</gallery>';
exit;
?>